package FitNess;

import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.TextField;
import java.awt.Button;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Panel;
import javax.swing.JButton;


public class milieu extends JPanel {

	/**
	 * Create the panel.
	 */
	public milieu() {
		setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBounds(0, 26, 759, 82);
		add(panel);
		panel.setLayout(null);
		
		TextField textField = new TextField();
		textField.setBounds(10, 20, 175, 34);
		panel.add(textField);
		
		Button button = new Button("Rechercher");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		button.setBounds(191, 20, 147, 34);
		panel.add(button);
		
		Button button_1 = new Button("Ajouter");
		button_1.setBounds(344, 20, 124, 34);
		panel.add(button_1);
		
		Button button_2 = new Button("Modifier");
		button_2.setBounds(477, 20, 121, 34);
		panel.add(button_2);
		
		JButton button_3 = new JButton("");
		button_3.setBounds(604, 20, 39, 34);
		panel.add(button_3);
		
		JButton btnNewButton = new JButton("");
		btnNewButton.setBounds(660, 20, 39, 34);
		panel.add(btnNewButton);
		
		Panel panel_1 = new Panel();
		panel_1.setBounds(0, 135, 759, 385);
		add(panel_1);

	}
	private static void addPopup(Component component, final JPopupMenu popup) {
		component.addMouseListener(new MouseAdapter() {
			public void mousePressed(MouseEvent e) {
				if (e.isPopupTrigger()) {
					showMenu(e);
				}
			}
			public void mouseReleased(MouseEvent e) {
				if (e.isPopupTrigger()) {
					showMenu(e);
				}
			}
			private void showMenu(MouseEvent e) {
				popup.show(e.getComponent(), e.getX(), e.getY());
			}
		});
	}
}
